perm filename SPSUB.REG[UP,DOC] blob sn#570111 filedate 1981-03-10 generic text, type T, neo UTF8
			18 JULY 1972

		     Updated 22 Dec 1977
		     Updated 10 Mar 1981

The following reports a new family of subroutines available in LIB40.


These subroutines are for people who want to be able to spool output to
the LPT, XGP or DOVER from their programs without going up to the monitor
and running SPOOL, XSPOOL or DOVER.  Each of these routines will cause one
file to be spooled.

Four routines are available for each device (LPT, XGP and DOVER); one each
for SAIL, machine language, and FORTRAN, and one for machine language
which allows full access to most spooler features.

---------------------------------------------------------------------

For SAIL programs:   These routines  are called by  the SAIL  calling
sequence:

	PUSH	16,SD1		;SAIL FORMAT STRING DESCRIPTOR-1
	PUSH	16,SD2		;SAIL FORMAT STRING DESCRIPTOR-2
	PUSH	17,IOCHAN
	PUSH	17,FLAGS
	PUSHJ	17,SPOOL	;for LPT

	PUSH	16,SD1		;SAIL FORMAT STRING DESCRIPTOR-1
	PUSH	16,SD2		;SAIL FORMAT STRING DESCRIPTOR-2
	PUSH	17,IOCHAN
	PUSH	17,FLAGS
	PUSHJ	17,XSPOOL	;for XGP

	PUSH	16,SD1		;SAIL FORMAT STRING DESCRIPTOR-1
	PUSH	16,SD2		;SAIL FORMAT STRING DESCRIPTOR-2
	PUSH	17,IOCHAN
	PUSH	17,FLAGS
	PUSHJ	17,DSPOOL	;for Dover

Which corresponds to the Sail statements:

EXTERNAL PROCEDURE SPOOL,XSPOOL,DSPOOL(STRING S;  INTEGER IOCHAN,FLAGS);

	...

	SPOOL("FOO.DAT[1,FOO]",4,'21);		COMMENT for LPT;

	XSPOOL("FOO.DAT[1,FOO]",4,'21);		COMMENT for XGP;

	DSPOOL("FOO.DAT[1,FOO]",4,'21);		COMMENT for Dover;

The  parameter  IOCHAN is used to select which channel the subroutine
is going to use for its output activity.  The channel  selected  will
be  released by this routine before it returns, hence the user should
select a channel on which there is no other IO activity.

---------------------------------------------------------------------

For FAIL and Macro programs the calling sequence is:

	EXTERN	SPOOLM,SPL%CN,XSPLM,XSP%FT
	...

	PUSHJ	17,SPOOLM		;For LPT spooling
	JUMP	ARGS

	PUSHJ	17,XSPLM		;For XGP spooling
	JUMP	ARGS

	PUSHJ	17,DSPLM		;For Dover spooling
	JUMP	ARGS

where ARGS is the address of a four word lookup block that has the
appropriate flags in the right half of ARGS+1. The IO channel that is used
may be selected by setting the external variable SPL%CN to some number
which will be used (mod 20 octal) as the channel number to use.  The
default is channel 17.  The font used in spooling on the XGP or Dover may
be specified by putting the sixbit font name into the external variable
XSP%FT.  The default is the system default font.  The address of ARGS may
be anywhere in your core, except that if you use the accumulators for
ARGS, then ARGS must be smaller than 14 so that all four words will fit
beneath 17.  As a programming convenience, all accumulators will be
restored by this routine to their original values.

---------------------------------------------------------------------

For Fortran programmers we offer:

	CALL  SPOOLF(FILE,EXT,FLAGS)

for LPT spooling, and

	CALL  XSPLF(FILE,EXT,FLAGS)

for XGP spooling, and

	CALL  DSPLF(FILE,EXT,FLAGS)

for Dover spooling.  FILE should contain an ascii string of up to five
letters used to specify the file name, and EXT may contain up to 3 ascii
letters used to specify the file extension.  Your project programmer
number will be assumed.

---------------------------------------------------------------------

For users who want all possible features:

	EXTERN	SPALL,SPL%CN,XSPALL,XSP%FT,D$SPAL

	PUSHJ	17,SPALL	;For LPT spooling
	JUMP	ARGS

	PUSHJ	17,XSPALL	;For XGP spooling
	JUMP	ARGS

	PUSHJ	17,D$SPAL	;For Dover spooling
	JUMP	ARGS

ARGS is the name (address) of an array containing at least 21 (octal)
words with the following data:

WORD NUMBER	SYMBOLIC NAME	DATA SUPPLIED BY USER
(octal)

0		CFORM		0 - DATA IS SET BY SPALL
1		RQNAM		0 
2		RQJOB		0 
3		FDEV		NAME OF SOURCE DEVICE, IN SIXBIT
4		DEVMOD		IO MODE FOR SOURCE DEVICE
5		FSIZE		0
6		RQTIME		XWD DATE,TIME IN MINUTES, SEE BELOW
7		FNAME		SIXBIT FILE NAME OF ACTUAL SOURCE
10		FEXT		SIXBIT FILE EXTENSION OF SOURCE
11		FDAT		0
12		FPPN		SIXBIT PPN OF FILE, IF NEEDED.
13		ANAME		ALIAS NAME IN SIXBIT
14		AEXT		ALIAS EXTENSION IN SIXBIT
15		APPN		ALIAS PPN IN SIXBIT
16		CBITS		FLAG BITS IN RIGHT SIDE (SEE BELOW),
				INITIAL PSEUDO-PAGE NUMBER IN LEFT.
17		CREP		XWD COMMAND REPEAT,LINE SPACE FACTOR
20		PSPEC		PAGE RANGE LIST

Notes:

If FPPN is 0, the PPN of the requestor (you) is used.  

If  FDEV is zero, device DSK will be assumed.  DEVMOD = 0 corresponds
to ascii character mode on the disk.

Headings  on the listing will use the ALIAS file name, extension, and
ppn, if these are non-zero. (Caution: if the desired alias  extension
is zero, set the right half of AEXT to non zero).

RQTIME: if the date and time specified is in the  future the  listing
will not be started before that time.  If this time is already  past,
(zero is past) this will be set to the current time.

FLAG BITS are defined in the section labeled "All programs".

COMMAND REPEAT is the number of times the file  will  be  listed,  (0
means once).

LINE SPACE FACTOR is the number of EXTRA line feeds per line feed. If
this  is  0 you get normal single spacing; 1 makes double spacing. If
bit 18 (400000 in the right half) is on, then  the  listing  will  be
single spaced with NO FORM FEED between pages.

PSPEC is the page (in octal mode, the word) range  specification.  If
PSPEC  is 0, the entire file will be listed. Otherwise, PSPEC and all
the non-zero words following it  will  be  used  as  the  page  bound
limits.   Only  pages  included  in  the range will be listed. A page
bound term has the form:
	XWD	 LOW BOUND,HIGH BOUND.

The number of page bound terms must be less than 160 (octal).

This subroutine will preserve all accumulators.  It uses one software
io channel, usually channel 17, but this can be  changed  by  storing
the channel to use in SPL%CN.

The font used in spooling on the XGP or Dover may be specified by putting
the sixbit font name into the external variable XSP%FT.  The default is
the system default font.

---------------------------------------------------------------------

All programs:

The flags have the following significance:

Octal	Bit		Meaning
1	(bit 35)	delete this file after listing
2	(bit 34)	do fortran carriage control
4	(bit 33)	use LPT mode 101 instead of mode 1.
10	(bit 32)	delete SOS line numbers
20	(bit 31)	print headings at the top of each page
40	(bit 30)	suppress the title page.
100	(bit 29)	make narrow title page for 8.5" paper
200	(bit 28)	list data as octal words.
400	(bit 27)	suppress message announcing "spooling done"
1000	(bit 26)	convert all line feeds to '177&'21.
2000	(bit 25)	input file for XGP contains fonts & margins at front
10000	(bit 23)	ignore chars beyond XGP right margin (no wraparound)
20000	(bit 22)	rotate output on Dover


The total effect of the flags is determined  by  the  logical  or  of
their  values.  For  example  a  flag value of '21 means to list with
headings at the top of each page and delete the file after spooling.
Some flags are ignored by certain devices.

SPSUB generally prints its own error messages if anything goes wrong,
but for those programs that need to know, an indication of success or
failure is returned in external variable SPL%ER.  (The synonym SPL$ER
is provided for use by SAIL programs, since SAIL doesn't permit %  in
identifiers.  Similarly, XSP$FT is a  synonym for XSP%FT, and  SPL$CN
for SPL%CN.   The  % symbols  are  kept for  compatibility  with  old
programs.)  The left half of this word is 0 if the spool request  was
entered, -1 otherwise.  The right  half indicates whether there  were
any problems (there may have been  problems even though the file  was
spooled), as follows:

Octal	Meaning
  0	No problems encountered
  1*	Error scanning argument string
  2*	LOOKUP failed (LOOKUP done only if file device is DSK)
  3*	Couldn't OPEN device DSK to write request
  4*	Output error
  5	Spooler has crashed (JERR bit on in job status word)
  6*	(SPOOLM, SPALL) Illegal call format (ARGS ptr not a JUMP)
  7*	(SPOOLM) Arguments overlap AC 17
 10*	(SPALL) Argument list is in AC's (not permitted)
 11*	(SPALL) Too many page specification terms
 12	Spooler created but then couldn't find it
 13	Multiple spoolers exist
 14	WAKEME failed for spooler job

* = error that results in spool request not being entered (LH = -1).


	The following three programs are examples of the use of this
subroutine.

SAIL EXAMPLE:

BEGIN "TEST OF SPOOLER SUBROUTINE"
EXTERNAL PROCEDURE SPOOL(STRING S; INTEGER IOCHAN,FLAG);
SPOOL("PROG.SAI[1,REG]",'17,'60);
END "TEST OF SPOOLER SUBROUTINE"


FORTRAN EXAMPLE:

	CALL SPOOLF('FPROG','F4',"20)
	END


FAIL EXAMPLE:


	TITLE TRY THE SPOOLER SUBROUTINE
	EXTERN	SPOOLM,SPL%CN
	P←17
STRT:	CALL	['RESET ']
	MOVEI	5
	MOVEM	SPL%CN
	MOVE	P,[IOWD PDLEN,PDLIST]
	PUSHJ	P,SPOOLM
	JUMP	[SIXBIT/MPROG/
		XWD 'FAI',20
		0
		SIXBIT/  1REG/]
	CALL	['EXIT  ']
PDLEN←←10
PDLIST: BLOCK PDLEN
	END	STRT


----------------------------------------------------------------------

Example of the use of SPALL and XSPALL, the general spooling subroutines:

	TITLE	ALLTST - TEST SPALL AND XSPALL SUBROUTINES
A←1
P←17
PDLEN←20
	EXTERN	SPALL,XSPALL,XSP%FT
STRT:	RESET
	MOVE	P,[IOWD PDLEN,PDLIST]
	PUSHJ	P,SPALL			;Spool on LPT
	JUMP	PARAMS

	MOVE	A,['FIX20 ']
	MOVEM	A,XSP%FT
	PUSHJ	P,XSPALL		;Now spool on XGP in FIX20
	JUMP	PARAMS
	EXIT

PDLIST:	BLOCK	PDLEN
PARAMS:	0		;CFORM
	0		;RQNAM
	0		;RQJOB
	0		;FDEV 	DSK IS DEFAULT
	0		;DEVMOD	MODE 0 IS ASCII SINGLE CHARACTER
	0		;FSIZE
	0		;RQTIME
	'ALLTST'	;FNAME
	0		;FEXT
	0		;FDAT
	0		;FPPN
	'ALIAS '	;ANAME	ALIAS NAME
	'RPG   '	;AEXT
	'FOOBAZ'	;APPN	ALIAS PPN
	110		;CBITS	NARROW TITLE AND NO SOS NUMBERS
	2,,0		;CREP	2 COPIES OF THE FILE
	0		;PSPEC	LIST THE ENTIRE FILE

	END 	STRT